import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        // 创建学生数组
        System.out.print("请输入要创建的学生数量: ");
        int count = scanner.nextInt();
        scanner.nextLine(); // 消耗换行符

        Student[] students = new Student[count];

        // 输入学生信息
        for (int i = 0; i < count; i++) {
            System.out.println("\n请输入第 " + (i + 1) + " 个学生的信息:");

            System.out.print("学号: ");
            String studentId = scanner.nextLine();

            System.out.print("姓名: ");
            String name = scanner.nextLine();

            System.out.print("年龄: ");
            int age = scanner.nextInt();
            scanner.nextLine(); // 消耗换行符

            // 创建学生对象并放入数组
            students[i] = new Student(studentId, name, age);
        }

        // 遍历数组，打印所有学生信息
        System.out.println("\n=== 所有学生信息 ===");
        for (Student student : students) {
            System.out.println(student);
        }

        scanner.close();
    }
}
